
<html  class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>用户登录</title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/login.css">
	  <link rel="stylesheet" href="css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="lib/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">
    
    <div class="login layui-anim layui-anim-up">
        <div class="message">用户登录</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" id="fmLogin">
        	<!--required-->
            <input name="name" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="Password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
            
            <hr class="hr20" >
                      
            
        </form>
     
 
    </div>
	
    <script type="text/javascript" src="js/jquery.min.js" ></script>
  <script type="text/javascript" src="js/User.js" ></script>
    <script>
        layui.use(['form'],function(){
            var form =layui.form,
                layer=layui.layer,
                $=layui.jquery;
            form.on('submit(login)',function(data){
                $.post(globalData.server+"public/login",$("#fmLogin").serialize(),function(res){
                    if(res.success){
                        console.log(res);
                        globalData.setUserInfo(res.user.name,res.token,res.user.id);
                        console.log(res.user.name);
                        console.log(res.token);
                        console.log(res.user.id);
                        window.location.href="index.html";
                    }else{
                        layer.msg(res.message,{
                            icon:2,
                            time:3000
                        });
                    }
                },"json");
                return false;
            });
        });
    </script>
    <!-- 底部结束 -->
</body>
</html>